# 场景1: 创建训练集和测试集的索引
import numpy as np


def create_train_test_split(data_size, test_ratio=0.2):
    """创建训练集和测试集的索引"""
    indices = np.arange(data_size)  # 创建序列索引
    np.random.shuffle(indices)  # 随机打乱

    test_size = int(data_size * test_ratio)
    test_indices = indices[:test_size]
    train_indices = indices[test_size:]

    return train_indices, test_indices


train_indices, test_indices = create_train_test_split(100)
